<?php
/*
 * Smarty.php
 * 集成模板引擎Smarty
 * 需在application目录下创建tpl_c文件夹，cache和tpl_c已经默认创建
 * 
 */
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );

require_once (APPPATH . 'libraries/Smarty/Smarty.class.php');

class CI_Smarty extends Smarty {
	public function __construct($template_dir = '', $compile_dir = '', $config_dir = '', $cache_dir = '') {
		parent::__construct ();
		if (is_array ( $template_dir )) {
			foreach ( $template_dir as $key => $value ) {
				$this->$key = $value;
			}
		} else {
			$this->cache_dir = $cache_dir ? $cache_dir : APPPATH . 'cache/';
			$this->template_dir = $template_dir ? $template_dir : APPPATH . 'views/';
			$this->compile_dir = $compile_dir ? $compile_dir : APPPATH . 'tpl_c/';
			$this->compile_check = true;
			$this->debugging = false; // debug模式
			$this->caching = 0; // 启用缓存
			$this->cache_lifetime =   6000;//缓存时间s
			$this->left_delimiter = '{';
			$this->right_delimiter = '}';
		}
	}
}